﻿@{
    ViewData["Title"] = "Add";
    Layout = null;
}

<link rel="stylesheet" href="~/layui/css/layui.css">
@*引用*@
<script src="~/Scripts/jquery-3.4.1.min.js"></script>
<script src="~/layer/Model/appsettings.js"></script>
<script src="~/layui/layui.js"></script>

<div style="width:800px">
    <form class="layui-form" action="/Operator/AddEf">
        <div class="layui-form-item">
            <label class="layui-form-label">公司名称：</label>
            <div class="layui-input-block">
                <input type="text" name="DepartmentName" required lay-verify="required" placeholder="请输入公司名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">姓名：</label>
            <div class="layui-input-block">
                <select id="Uid" lay-filter="aihao" name="UserId">
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分配角色：</label>
            <div class="layui-input-block">
                <select id="Rid" lay-filter="aihao" name="RoleId">
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">输入账号：</label>
            <div class="layui-input-block">
                <input type="text" name="Account" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">输入密码：</label>
            <div class="layui-input-block">
                <input type="text" name="PassWord" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" type="submit" lay-submit>立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" onclick="tz()">返回</button>
            </div>
        </div>
    </form>
</div>

<script>
    //Demo
    layui.use('form', function () {
        var form = layui.form;
        form.render();
        //监听提交

        form.on('submit(formDemo)', function (data) {
        });
    });

    var tz = function () {
        location.href = "/Operator/Index"
    }

    $(function () {
        getyg();
        getrole()
    })

    function getyg() {
        $.ajax({
            url: "/Operator/GetBasic",
            type: "get",
            async: false,
            processData: false,
            contentType: false,
            dataType: "json",
            success: function (obj) {
                $(obj).each(function () {
                    $("#Uid").append("<option value=" + this.id + ">" + this.name + "</option>")
                })
            }
        })

    };
    function getrole() {
        $.ajax({
            url: "/Operator/GetRoleslx",
            type: "get",
            async: false,
            processData: false,
            contentType: false,
            dataType: "json",
            success: function (obj) {
                $(obj).each(function () {
                    $("#Rid").append("<option value=" + this.id + ">" + this.name + "</option>")
                })
            }
        })

    };

</script>

